﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    assembly="KuaJing.Organization"
    namespace="KuaJing.Organization.Domain">

  <class name="Employee" table="Organization_Employee">
    <id name="Id" access="field.camelcase"
        column="Id" type="Int32">
      <generator class="native" />
    </id>
    <version name="Version" access="field.camelcase"/>
    <property name="OfficePhone" />
    <property name="Status" />

    <many-to-one name="Person" column="PersonId"
    class="KuaJing.People.Domain.Person,KuaJing.People" cascade="all"  lazy="proxy" />

    <set name="Organizations" table="Organization_OrganizationUnit_Employee" inverse="false"  cascade="all" >
      <key column="EmployeeId" foreign-key="FK_Organization_Employee_EmployeeId_Organization_OrganizationUnit_OrganizationId"></key>
      <many-to-many class="OrganizationUnit" column="OrganizationId"></many-to-many>
    </set>

    <set name="Positions"  table="Organization_Position_Employee" inverse="false"  cascade="all" >
      <key column="EmployeeId" foreign-key="FK_Organization_Position_PositionId_Organization_Employee_EmployeeId"></key>
      <many-to-many class="Position" column="PositionId"></many-to-many>
    </set>

    <property name="CreatedTime" access="field.camelcase" />
    <property name="CreatedUserName" access="field.camelcase" />
    <property name="ModifiedTime" access="field.camelcase" />
    <property name="ModifiedUserName" access="field.camelcase" />
    <property name="AccessedTime" access="field.camelcase" />
    <property name="AccessedUserName" access="field.camelcase" />
    <property name="Memo" />
    <property name="IsInvalid" />
  </class>
</hibernate-mapping>


